class Node {
public:
	Node *father = nullptr;
	float ucb;
	int Q;
	int N;
	vector<Node> children;
	Node *maxUCBChild;
	State *state;
	boolean end;
	int winColor = 0;

	Node(Node *father, State *state);

	void runOnce();

	void backpropagation(int winColor, Node *node);

	void updateQN(int winColor);

	Node *setMaxUCBChild();

	Node *getMaxNChild();

	Node getMaxRateChild();

	void createChildren();

	int simulate();

	int getWinColor(State state);

	int getRandomInt(int max);

	float updateUCB();

	Node *getChild(int x, int y);
};
